import rxAjax from '@/assets/js/ajax.js';

//资源共享 api接口
const FormResourceShareApi = {};

FormResourceShareApi.baseUrl= '/api-form/form/core/formResourceShare';
FormResourceShareApi.exportUrl= FormResourceShareApi.baseUrl + '/listExport';

//获取 当前应用资源共享的APP列表
FormResourceShareApi.getAllShareApps=function(appId){
    var url= FormResourceShareApi.baseUrl + '/getAllShareApps?appId=' + appId;
    return rxAjax.get(url);
}
//获取 当前应用资源被共享的APP列表
FormResourceShareApi.getAllShareMyApps=function(appId){
    var url= FormResourceShareApi.baseUrl + '/getAllShareMyApps?appId=' + appId;
    return rxAjax.get(url);
}
//获取 资源共享的APP列表
FormResourceShareApi.getShareApps =function(resId) {
    var url= FormResourceShareApi.baseUrl + '/getShareApps?resId=' + resId;
    return rxAjax.get(url);
}
//保存 资源共享的APP列表
FormResourceShareApi.saveShareApps =function(data,resId,resKey,resName,type) {
    var url = FormResourceShareApi.baseUrl + '/saveShareApps?resId=' + resId
        + '&resKey=' + resKey + '&resName=' + resName + "&type=" + type;
    return rxAjax.postJson(url, data);
}
//保存 应用内资源共享的APP列表
FormResourceShareApi.saveAllShareApps=function(data){
    var url=FormResourceShareApi.baseUrl + '/saveAllShareApps';
    return rxAjax.postJson(url,data);
}

FormResourceShareApi.queryResourceListByAppIdAndType = function(appId,type){
    var url = FormResourceShareApi.baseUrl + '/queryResourceListByAppIdAndType?appId=' + appId + '&type=' + type;
    return rxAjax.get(url);
}

FormResourceShareApi.queryResourceListByShareAppIdAndType = function(appId,resourceAppId,type){
    var url = FormResourceShareApi.baseUrl + '/queryResourceListByShareAppIdAndType?appId=' + appId + '&resourceAppId='+ resourceAppId + '&type=' + type;
    return rxAjax.get(url);

}

export  default FormResourceShareApi;

